package org.lvgo.proxy.play;

/**
 * @author lvgo
 * @version 1.0
 * @Description: 游乐园的代理, (检票处)
 * @date 18-8-23 上午9:58
 */
public class AmusementParkProxy implements TicketCheck {

    private static int MAX_ENTER_NUM = 5;
    private TicketCheck ticketCheck;
    private int current;

    public AmusementParkProxy(TicketCheck ticketCheck) {
        this.ticketCheck = ticketCheck;
    }


    /**
     * 定义一个进入游乐园的方法
     *
     * @param children 小朋友
     */
    @Override
    public void enter(Children children) {
        if (current < MAX_ENTER_NUM) {
            ticketCheck.enter(children);
            current++;
        } else {
            System.out.println("抱歉,今天" + children.getName() + "不能够再进去了,游乐园要爆炸了");
        }
    }
}
